<template>
  <view class="root">
    <view class="content" v-show="!visibleCamera">
      <uni-forms ref="form" :model="form" validateTrigger="blur" :border="true" err-show-type="toast" label-width="95">
        <view class="title-require-style">房屋信息(必填)</view>
        <view class="content-inner-wrapper content-inner-wrapper-house">
          <uni-forms-item label="标准地址" name="addressDetail" required v-if="['edit', 'perfect'].includes(options.type)">
            <view class="form-content-item" @click="">
              <!-- <uni-easyinput type="text" v-model="form.addressDetail" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" /> -->
              <view :class="form.addressDetail ? 'long-select-value' : 'long-select-value-empty'">
                {{form.addressDetail ? form.addressDetail : '请选择'}}
              </view>
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <!-- 新增 -->
          <uni-forms-item label="标准地址" name="addressDetail" required v-else>
            <view class="form-content-item" @click="handleAddressClick">
              <!--          <uni-easyinput type="text" v-model="form.addressDetail" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" /> -->
              <view :class="form.addressDetail ? 'long-select-value' : 'long-select-value-empty'">
                {{form.addressDetail ? form.addressDetail : '请选择'}}
              </view>
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <!--  <uni-forms-item label="房屋类别" name="form.fFwlb" required>
            <view class="form-content-item" @click="hadleShowPicker('house_category', 'fFwlb')">
              <uni-easyinput type="text" v-model="form.fFwlb_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item> -->
          <!-- <uni-forms-item label="房屋性质" name="houseStructure" required>
            <view class="form-content-item" @click="hadleShowPicker('house_nature', 'fFwxz')">
              <uni-easyinput type="text" v-model="form.fFwxz_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item> -->
          <uni-forms-item label="房屋类型" name="fFwlx" required key="fFwlx">
            <view class="form-content-item" @click="hadleShowPicker('house_type', 'fFwlx')">
              <uni-easyinput type="text" v-model="form.fFwlx_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="房屋用途" name="fFwyt" required key="fFwyt">
            <view class="form-content-item" @click="hadleShowPicker('house_use', 'fFwyt')">
              <uni-easyinput type="text" v-model="form.fFwyt_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="房屋状态" name="fFwstatus" required key="fFwstatus">
            <view class="form-content-item" @click="hadleShowPicker('house_status', 'fFwstatus')">
              <uni-easyinput type="text" v-model="form.fFwstatus_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <!-- <template v-if="form.fFwlx == 2">
            <uni-forms-item label="房屋状态" name="fFwzt" required key="fFwlx">
              <view class="form-content-item" @click="hadleShowPicker('house_status', 'fFwzt')">
                <uni-easyinput type="text" v-model="form.fFwzt_text" disabled disableColor="#ffffff"
                  :inputBorder="false" placeholder="请选择" :clearable="true" />
                <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
              </view>
            </uni-forms-item>
          </template> -->
          <uni-forms-item label="是否重点房屋" name="fIszdgz" required key="fIszdgz">
            <view class="form-content-item" @click="hadleShowPicker('is_important_house', 'fIszdgz')">
              <uni-easyinput type="text" v-model="form.fIszdgz_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <template v-if="form.fIszdgz == 1">
            <uni-forms-item label="重点房屋类型" name="fZdgzFwlx" required key="fZdgzFwlx">
              <view class="form-content-item" :class="form.fZdgzFwlx ? '' : 'input-item'">
                <uni-easyinput type="text" v-model="form.fZdgzFwlx" :inputBorder="false" placeholder="请填写"
                  :clearable="true" />
              </view>
            </uni-forms-item>
            <uni-forms-item label="设置原因" name="fZdgzYy" required key="fZdgzYy">
              <view class="form-content-item" :class="form.fZdgzYy ? '' : 'input-item'">
                <uni-easyinput type="text" v-model="form.fZdgzYy" :inputBorder="false" placeholder="请填写"
                  :clearable="true" />
              </view>
            </uni-forms-item>
          </template>
          <!-- <uni-forms-item label="房屋间数(间)" name="fFwjs" required>
            <view class="form-content-item" :class="form.fFwjs ?  '' : 'input-item'">
              <uni-easyinput type="number" v-model="form.fFwjs" :inputBorder="false" placeholder="请填写"
                :clearable="true" />
            </view>
          </uni-forms-item>
          <uni-forms-item label="房屋面积(㎡)" name="fFwmj" required>
            <view class="form-content-item" :class="form.fFwmj ?  '' : 'input-item'">
              <uni-easyinput type="digit" v-model="form.fFwmj" :inputBorder="false" placeholder="请填写" :clearable="true"
                @input="handleArea($event, 'fFwmj')" />
            </view>
          </uni-forms-item>
          <uni-forms-item label="房屋产权号" name="fFwcqh" required>
            <view class="form-content-item" :class="form.fFwcqh ?  '' : 'input-item'">
              <uni-easyinput type="text" v-model="form.fFwcqh" :inputBorder="false" placeholder="请填写"
                :clearable="true" />
            </view>
          </uni-forms-item> -->
        </view>
        <view class="title-require-style" v-if="['add', 'perfect'].includes(options.type)">房屋负责人信息(必填)</view>
        <view class="content-inner-wrapper content-inner-wrapper-house-manager"
          v-if="['perfect', 'add'].includes(options.type)">
          <uni-forms-item label="负责人类型" name="fSftgrtg" required>
            <view class="form-content-item" @click="hadleShowPicker('is_house_owner', 'fSftgrtg')">
              <uni-easyinput type="text" v-model="form.fSftgrtg_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="与房主关系" name="fTgryfzgx" required v-if="form.fSftgrtg == 1">
            <view class="form-content-item" @click="hadleShowPicker('homeowner_relationship', 'fTgryfzgx')">
              <uni-easyinput type="text" v-model="form.fTgryfzgx_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="负责人国籍" name="fTgrGj" required>
            <view class="form-content-item" @click="hadleShowPicker('nationality', 'fTgrGj')">
              <uni-easyinput type="text" v-model="form.fTgrGj_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="证件类型" name="fTgrZjlx" required>
            <view class="form-content-item" @click="hadleShowPicker('certificate_type', 'fTgrZjlx')">
              <uni-easyinput type="text" v-model="form.fTgrZjlx_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <uni-forms-item label="证件号码" name="fTgrGmsfhm" required>
            <view class="form-content-item">
              <uni-easyinput type="idcard" :maxlength="18" v-model="form.fTgrGmsfhm" :inputBorder="false"
                placeholder="请填写" :clearable="true" @blur="handleIdCardChange" />
              <u-icon v-if="form.fTgrZjlx == 10" slot="right" size="21" name="scan" color="#2488F5"
                @click="handleCamera"></u-icon>
            </view>
          </uni-forms-item>

          <uni-forms-item label="姓名" name="fTgrXm" required>
            <view class="form-content-item" :class="form.fTgrXm ? '' : 'input-item'">
              <uni-easyinput type="text" v-model="form.fTgrXm" :inputBorder="false" placeholder="请填写"
                :clearable="true" />
            </view>
          </uni-forms-item>
          <uni-forms-item label="民族" name="fTgrMz" required>
            <view class="form-content-item" @click="hadleShowPicker('nation', 'fTgrMz')">
              <uni-easyinput type="text" v-model="form.fTgrMz_text" disabled disableColor="#ffffff" :inputBorder="false"
                placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <!-- <uni-forms-item label="户籍地址" name="residenceAddress" required>
            <view class="form-content-item" :class="form.residenceAddress ? '' : 'input-item'">
              <uni-easyinput type="text" v-model="form.residenceAddress" disableColor="#ffffff" :inputBorder="false"
                placeholder="请填写" :clearable="true" />
            </view>
          </uni-forms-item>
          <uni-forms-item label="户籍地所属区县" name="fTgrHjssxqbm" required>
            <view class="form-content-item" @click="cityPickerVisible = true">
              <uni-easyinput type="text" v-model="form.fTgrHjssxqbm_text" disabled disableColor="#ffffff"
                :inputBorder="false" placeholder="请选择" :clearable="true" />
              <uni-icons type="right" size="21" color="#C2C0C0"></uni-icons>
            </view>
          </uni-forms-item>
          <view class="hint" style="font-size: 10px;color: #f56c6c;margin-top: -20rpx;padding-bottom: 10rpx;"
            v-if="areaList.length">
            户籍所属区县由系统自动匹配，如匹配不准确或未匹配到请务必手动修改!
          </view> -->
          <uni-forms-item label="联系电话" name="fTgrLxdh" required>
            <view class="form-content-item" :class="form.fTgrLxdh ? '' : 'input-item'">
              <uni-easyinput type="number" :maxlength="11" v-model="form.fTgrLxdh" :inputBorder="false"
                placeholder="请填写" :clearable="true" />
            </view>
          </uni-forms-item>
        </view>
      </uni-forms>

      <view class="button-wrapper">
        <view class="cancel btn-item" @click="handleCancel">取消</view>
        <u-button class="custom-style" text="保存" @click="handleSubmit" :disabled="loading"
          :custom-style="customSubmitStyleHalf"></u-button>
      </view>

      <u-picker closeOnClickOverlay v-if="pickerShow" :show="pickerShow" :columns="pickerData" keyName="text"
        @confirm="onPickerConfirm" @cancel="pickerShow = false" @close="pickerShow = false"
        :defaultIndex="defaultIndex"></u-picker>

      <!--     <yy-city-picker :visible="cityPickerVisible" @confirm="onCityConfirm"
        @cancel="cityPickerVisible = false"></yy-city-picker> -->

      <yy-city-picker-all v-if="cityPickerVisible" :visible="cityPickerVisible" @confirm="onCityConfirm"
        @cancel="cityPickerVisible = false" :default-value="defaultCityCode"></yy-city-picker-all>
    </view>
    <yy-photo-mask :visible.sync="visibleCamera" :baseImgUrl="baseImgUrl" :clientId="clientId"
      :clientSecret="clientSecret" @generateFilePath="onGenerateFilePath"
      @parsedSuccess="onParsedSuccess"></yy-photo-mask>
    <yy-watermark></yy-watermark>
  </view>
</template>

<script>
  import {
    postAction
  } from "../utils/request";
  import {
    findCompany,
    infoDetailSave
  } from "@/api/home";
  import moment from "@/utils/moment";
  import pickerMixin from "@/utils/picker-mixin";
  import {
    Toast,
    checkIDCard,
    getHeader,
    isLoading,
    navBack,
    parseJson,
    selectNation,
    uploadFile,
    customSubmitStyleHalf,
    setDefaultProvinceCode,
  } from "@/utils/util";

  import _ from '@/utils/lodash.js'


  export default {
    mixins: [pickerMixin],
    data() {
      return {
        form: this.initForm(),
        clientId: this.$clientId,
        clientSecret: this.$clientSecret,
        baseImgUrl: this.$baseImgUrl,
        visibleCamera: false,
        rules: {
          addressDetail: {
            rules: [{
              required: true,
              errorMessage: "请选择标准地址！",
            }, ],
          },
          fFwlb: {
            rules: [{
              required: true,
              errorMessage: "请选择房屋类别！",
            }, ],
          },
          fFwxz: {
            rules: [{
              required: true,
              errorMessage: "请选择房屋性质！",
            }, ],
          },
          fFwlx: {
            rules: [{
              required: true,
              errorMessage: "请选择房屋类型！",
            }, ],
          },
          fIszdgz: {
            rules: [{
              required: true,
              errorMessage: "请选择是否重点房屋！",
            }, ],
          },
          fZdgzFwlx: {
            rules: [{
              required: true,
              errorMessage: "请填写重点房屋类型！",
            }, ],
          },
          fZdgzYy: {
            rules: [{
              required: true,
              errorMessage: "请填写设置原因！",
            }, ],
          },
          fFwyt: {
            rules: [{
              required: true,
              errorMessage: "请选择房屋用途！",
            }, ],
          },
          fFwstatus: {
            rules: [{
              required: true,
              errorMessage: "请选择房屋状态！",
            }, ],
          },
          fFwjs: {
            rules: [{
              required: true,
              errorMessage: "请填写房屋间数！",
            }, ],
          },
          fFwmj: {
            rules: [{
              required: true,
              errorMessage: "请填写房屋面积！",
            }, ],
          },
          fFwcqh: {
            rules: [{
              required: true,
              errorMessage: "请填写房屋产权号！",
            }, ],
          },
          fSftgrtg: {
            rules: [{
              required: true,
              errorMessage: "请选择负责人类型！",
            }, ],
          },
          fTgrGj: {
            rules: [{
              required: true,
              errorMessage: "请选择负责人国籍！",
            }, ],
          },
          fTgrZjlx: {
            rules: [{
              required: true,
              errorMessage: "请选择负责人证件类型！",
            }, ],
          },
          fTgryfzgx: {
            rules: [{
              required: true,
              errorMessage: "请选择与房主关系！",
            }, ],
          },
          fTgrGmsfhm: {
            rules: [{
                required: true,
                errorMessage: "请填写证件号码！",
              },
              {
                validateFunction: (rule, value, data, callback) => {
                  // 如果是身份证再进行校验
                  if (this.fTgrZjlx == 10) {
                    if (!checkIDCard(value)) {
                      callback("请输入正确的证件号码!");
                    }
                  }
                  return true;
                },
              },
            ],
          },
          fTgrXm: {
            rules: [{
              required: true,
              errorMessage: "请填写姓名！",
            }, ],
          },
          fTgrMz: {
            rules: [{
              required: true,
              errorMessage: "请选择民族！",
            }, ],
          },
          // residenceAddress: {
          //   rules: [{
          //     required: true,
          //     errorMessage: "请填写户籍地址！",
          //   }, ],
          // },
          // fTgrHjssxqbm: {
          //   rules: [{
          //     required: true,
          //     errorMessage: "请选择户籍地所属区县！",
          //   }, ],
          // },

          fTgrLxdh: {
            rules: [{
                required: true,
                errorMessage: "请填写联系电话！",
              },
              {
                validateFunction: (rule, value, data, callback) => {
                  if (!this.$u.test.mobile(value)) {
                    callback("请输入正确的联系电话!");
                  }
                  return true;
                },
              },
            ],
          },
        },
        dictMapping: {
          is_house_owner: [{
              text: "托管人",
              value: "1",
            },
            {
              text: "房主本人",
              value: "0",
            },
          ]
        },
        options: {},
        formDictMap: [
          "fFwlb",
          "fFwxz",
          "fFwlx",
          "fFwzt",
          "fIszdgz",
          "fFwyt",
          "fSftgrtg",
          "fTgryfzgx",
          "fTgrMz",
        ],
        isEmpty: false,
        cityPickerVisible: false,
        loading: false,
        customSubmitStyleHalf,

        areaList: [],
        defaultCityCode: '',
      };
    },
    watch: {},
    // 定义 actionType 'add' 'modify'
    // 其他参数放在 params 里面
    onLoad(options) {
      if (options) {
        this.options = options;
        // 完善
        if (options.item) {
          let item = JSON.parse(options.item);
          this.$set(this.form, "fNames", item.fJlxxqmc);
          this.$set(this.form, "fSsjlxxqDzbm", item.fDzbm);
          this.$set(this.form, "addressDetail", item.fJlxxqmc + item.roomName);
          this.$set(this.form, "fSsjzwDzbm", item.jzFDzbm);
          this.$set(this.form, "fSsdyDzbm", item.dyFDzbm);
          this.$set(this.form, "fSslcDzbm", item.lcFDzbm);
          this.$set(this.form, "fSsjzwdyfwDzbm", item.fzFDzbm);
          this.$set(this.form, "buildType", item.buildType + "");
        }
        // 编辑
        if (options.editOptions) {
          let editOptions = JSON.parse(options.editOptions);
          this.form = {
            ...editOptions,
          };
          this.formDictMap.forEach((key) => {
            this.$set(this.form, `${key}_text`, editOptions[`${key}Name`]);
          });
          // 房屋状态
          this.$set(this.form, `fFwstatus`, editOptions[`fFwstatus`]);
          this.$set(this.form, `fFwstatus_text`, editOptions[`fFwstatusName`]);
          delete this.form.policeJurisdictionId;
          delete this.form.policeAgencyId;
        }
      }
    },
    onShow() {
      uni.$on("select-standard-address", (data) => {
        this.setStandardAddressInfo(data);
      });
    },
    onReady() {
      this.$refs.form.setRules(this.rules);
    },
    methods: {
      handleIdCardChange() {
        let params = {
          idCard: this.form.fTgrGmsfhm,
          fDzbm: this.form.fSsjzwDzbm
        }
        if (this.form.fTgrZjlx == 10) {
          setDefaultProvinceCode.call(this, params, ({
            code,
            address
          }) => {
            this.defaultCityCode = code
          })
        }
      },
      moment,
      setStandardAddressInfo(data) {
        const {
          fJlxxqmc,
          fDzbm,
          roomName,
          jzFDzbm,
          dyFDzbm,
          lcFDzbm,
          fzFDzbm,
          jlxFDzbm,
          buildType,
        } = data;
        if (fJlxxqmc) this.$set(this.form, "fNames", fJlxxqmc);
        if (roomName) this.$set(this.form, "addressDetail", roomName);
        if (jzFDzbm) this.$set(this.form, "fSsjzwDzbm", jzFDzbm);
        if (dyFDzbm) this.$set(this.form, "fSsdyDzbm", dyFDzbm);
        if (lcFDzbm) this.$set(this.form, "fSslcDzbm", lcFDzbm);
        if (fzFDzbm) this.$set(this.form, "fSsjzwdyfwDzbm", fzFDzbm);
        if (jlxFDzbm) this.$set(this.form, "fSsjlxxqDzbm", jlxFDzbm);
        if (buildType !== undefined)
          this.$set(this.form, "buildType", buildType + "");
      },
      initForm() {
        return {
          addressDetail: "",
          fFwlb: "",
          fFwxz: "",
          fFwlx: "",
          fIszdgz: "",
          fFwyt: "",
          fFwjs: "",
          fFwmj: "",
          fFwcqh: "",
          fSftgrtg: "",
          fTgrGmsfhm: "",
          fTgrXm: "",
          fTgrMz: "",
          fTgrLxdh: "",
          // residenceAddress: "", // 户籍地址
          // fTgrHjssxqbm: "", // 户籍编码
          // fTgrHjssxqbm_text: "",
          fTgrGj: 'CHN',
          fTgrGj_text: '中国',
          fTgrZjlx: '10',
          fTgrZjlx_text: '身份证',
        };
      },
      onTimeChange(e) {
        this.form.openingTime = e;
      },
      handleSubmit() {
        this.$refs.form
          .validate()
          .then(async (res) => {
            // 成功返回，res 为表单数据
            let data = {
              companyId: this.options.companyMessageId,
              ...this.form,
            };
            // 编辑
            if (this.form.fHouseid) {
              this.loading = true;
              postAction(`/indeed/house/upzdstSyfwnfo`, this.form)
                .then((res) => {
                  if (res.code === 200) {
                    Toast("操作成功");
                    setTimeout(() => {
                      navBack();
                    }, 1000)
                  } else {
                    this.loading = false
                    Toast(res.message)
                  }
                })
                .catch(() => {
                  this.loading = false;
                });
            } else {
              // 新增
              this.loading = true;
              postAction(`/indeed/house/addUnits`, this.form)
                .then((res) => {
                  if (res.code === 200) {
                    Toast('添加成功')
                    let item = parseJson(this.options.item);
                    uni.$emit("perfected", item);
                    setTimeout(() => {
                      navBack();
                      uni.$emit('real_estate_add')
                    }, 1000)
                  } else {
                    this.loading = false
                    Toast(res.message)
                  }
                })
                .catch(() => {
                  this.loading = false;
                });
            }
          })
          .catch((err) => {
            // 表单校验验失败，err 为具体错误信息
          });
      },
      handleCancel() {
        navBack();
      },
      onGenerateFilePath(fileurl) {
        this.uploadImage(fileurl, 44);
      },
      handleCamera() {
        this.visibleCamera = true;
      },
      uploadImage(fileurl, type) {
        uploadFile({
            url: "/web/sys/upload/upload_file",
            filePath: fileurl,
            name: "file",
            formData: {
              type,
            },
          })
          .then((res) => {
            isLoading(false);
            let {
              fullPath,
              halfPath
            } = res.result;
            if (type == 44) {
              this.fileList = [];
              this.fileList.push({
                url: fullPath,
              });
              this.form.idCardImage = halfPath;
            }
          })
          .finally(() => {});
      },
      onParsedSuccess(value) {
        const {
          domicileAddress,
          userName,
          idcard,
          nation
        } = value;
        this.$set(this.form, "fTgrXm", userName);
        this.$set(this.form, "fTgrGmsfhm", idcard);
        // this.$set(this.form, "residenceAddress", domicileAddress);
        this.handleIdCardChange()
        let nationOption = selectNation(this.dictMapping, nation);
        if (nationOption) {
          this.form.fTgrMz = nationOption.value;
          this.form.fTgrMz_text = nationOption.text;
        }
        this.visibleCamera = false;
      },
      handleAddressClick() {
        uni.navigateTo({
          url: "/actual_real_estate/selectStandardAddress",
        });
      },
      handleArea(value, key) {
        value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
        value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
        value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数
        this.$nextTick(() => {
          this.$set(this.form, key, value);
        });
        if (value.indexOf(".") < 0 && value != "") {
          //以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
          value = parseFloat(value);
          this.$nextTick(() => {
            this.$set(this.form, key, value);
          });
        }
        if (value || value == "0" || value == "0.0" || value == "0.00") {
          return;
        }
        //  正常得话继续调后端接口
      },
      onCityConfirm(event) {
        // this.form.fTgrHjssxqbm_text = event.address;
        // this.form.fTgrHjssxqbm = event.code;
        this.cityPickerVisible = false;
      },
      onPickerConfirm(data, formName = 'form') {
        let {
          value,
          text
        } = data.value[0];
        this[formName][this.pickerWithFormKey] = value;
        this.$set(this[formName], `${this.pickerWithFormKey}_text`, text);
        // 如果房屋类型发生了变化，则清空是否出租
        this.pickerShow = false;
      },
    },
  };
</script>

<style>
  page {
    background: #f9f9f9;
    box-sizing: border-box;
  }
</style>

<style lang="scss" scoped>
  @import "../styles/uni-form.scss";
  @import "../styles/submit-button.scss";

  .root {
    .content {
      .content-inner-wrapper {
        padding: 0 16rpx;
        border-radius: 16rpx 16rpx 16rpx 16rpx;
        background: #fff;
        margin-bottom: 10rpx;
      }
    }

    /deep/.uni-forms {
      margin-bottom: 130rpx;

      & view:nth-of-type(1).uni-forms-item {
        border: 0 !important;
      }
    }

    .title-require-style {
      font-weight: 500;
      font-size: 26rpx;
      color: #999999;
      height: 100rpx;
      display: flex;
      align-items: center;
    }
  }
</style>